<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>用户管理</title>
        <meta name="renderer" content="webkit" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
        <link rel="stylesheet" href="/layui/css/layui.css" media="all" />
        <script src="/layui/layui.js" charset="utf-8"></script>
        <script src="/js/jquery-1.12.3.min.js" charset="utf-8"></script>
        <script src="{$Think.const.JS_URL}common.js"></script>
    </head>
    <body>
        <br />
        <!-- 退出模板框 -->
        <div class="margin-top30 J-temple is-hidden">
            <form class="layui-form layui-fluid J-add-form" lay-filter="formTest">
                <input type="hidden" class="form-control" id="id" name="id" value="" placeholder="请输入内容" />
                <input type="hidden" class="form-control" id="schoolid" name="schoolid" value="99" placeholder="请输入内容" />
                <input type="hidden" class="form-control" id="banjiid" name="classid" value="" placeholder="请输入内容" />
                <div class="layui-form-item">
                    <label class="layui-form-label">学期</label>
                    <div class="layui-input-block">
                        <input type="text" lay-verify="required" required lay-reqtext="必填" autocomplete="off" class="layui-input" name="term" id="term" placeholder="请输入内容" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">课程</label>
                    <div class="layui-input-block">
                        <select name="kechengid">
                            {volist name='kechengdata' id='kechengdata'}
                            <option value="{$kechengdata.id}">{$kechengdata.coursename}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">学生</label>

                    <div class="layui-input-block">
                        <select name="studentid" id="studentid">
                            {volist name='studentsData' id='studentsData'}
                            <option value="{$studentsData.id}">{$studentsData.studentname}</option>
                            {/volist}
                        </select>
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">平时成绩</label>
                    <div class="layui-input-block">
                        <input type="text" lay-verify="required" required lay-reqtext="必填" autocomplete="off" class="layui-input" name="usual_score" placeholder="请输入内容" />
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">考试成绩</label>
                    <div class="layui-input-block">
                        <input type="text" lay-verify="required" required lay-reqtext="必填" autocomplete="off" class="layui-input" name="test_score" placeholder="请输入内容" />
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">实践成绩</label>
                    <div class="layui-input-block">
                        <input type="text" lay-verify="required" required lay-reqtext="必填" autocomplete="off" class="layui-input" name="practice_score" placeholder="请输入内容" />
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">总成绩</label>
                    <div class="layui-input-block">
                        <input type="text" lay-verify="required" required lay-reqtext="必填" autocomplete="off" class="layui-input" name="total_score" placeholder="请输入内容" />
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <textarea name="memo" id="memo" placeholder="请输入内容" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="add">修改</button>
                    </div>
                </div>
            </form>
        </div>
        <br />

        <script>
            layui.use(['form'], function () {
                var form = layui.form,
                    layer = layui.layer,
                    editurl = "{:url('score/result_input_modify')}";
                //监听提交
                form.on('submit(add)', function (data) {
                    var userInfo = data.field;
                    ajaxRequest('post', editurl, userInfo, function (data) {
                        var errMesage = data.msg ? data.msg : data;
                        data.code == 1 ? successTrip(data) : errorAlert(false, errMesage);
                        parent.location.reload();
                    });
                    return false;
                });

                ajaxRequest('get', editurl, { id: getUrlVariable('id') }, function (res) {
                    form.val('formTest', res.data);
                });
            });

            layui.use('upload', function () {
                var $ = layui.jquery,
                    upload = layui.upload;

                //指定允许上传的文件类型
                upload.render({
                    elem: '#test1',
                    url: '{:url("upload/img")}', //改成您自己的上传接口
                    accept: 'images', //普通文件
                    acceptMime: 'image/*',
                    size: 1024 * 5, //最大允许上传的文件大小
                    number: 1,
                    progress: function (n, elem) {
                        var percent = n + '%';
                        element.progress('demoText', percent);
                    },
                    done: function (res) {
                        layer.msg(res.msg);
                        $('#demo1').attr('src', '/' + res.data.src);
                        $('#pic').val('/' + res.data.src);
                        console.log(res);
                    },
                });
            });
        </script>
    </body>
</html>
